<?php

namespace App\Http\Middleware\Mobile\User;

use Closure;

class LoginMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        if (session('mobile')) {
            return $next($request);
        }

        return redirect(route('user.login'))->with('info', '请登录');
    }
}
